import request from '@/config/axios'

export interface HouseRoomVo {
	id: number
	commId: number
	parentId: number
	addrCode: string
	name: string
	shortName: string
	sort: number
	cloudLinkId: number
	extendAttrs: string
}

export interface configureRoomVo {
	id: number
	matCodeId: number
}

// 创建房产管理
export const createHouseRoom = async (data: HouseRoomVo) => {
	return await request.post({
		url: '/zwsj/house-room/create',
		data: data,
	})
}

// 更新房产管理
export const updateHouseRoom = async (data: HouseRoomVo) => {
	return await request.put({
		url: '/zwsj/house-room/update',
		data: data,
	})
}

// 删除房产管理
export const deleteHouseRoom = async (id: number) => {
	return await request.delete({
		url: `/zwsj/house-room/delete?id=` + id,
	})
}

// 获得房产管理
export const getHouseRoom = async (id: number) => {
	return await request.get({
		url: `/zwsj/house-room/get?id=` + id,
	})
}

// 获得房产管理分页
export const getHouseRoomPage = async (params: any) => {
	return await request.get({
		url: '/zwsj/house-room/page',
		params: params,
	})
}

// 关键字搜索房屋
export const getHousesByManagerForSearch = async (params: any) => {
	return await request.get({
		url: '/zwsj/house-room/auth/house/page',
		params: params,
	})
}

// 关键字搜索房间
export const getRoomsByHouseIdForSearch = async (params: any) => {
	return await request.get({
		url: '/zwsj/house-room/auth/room/page',
		params: params,
	})
}

// 复制房产地址下的房间列表（便民）
export const copyRoomsFromBm = async (houseAddrCode: string) => {
	return await request.get({
		url: `/zwsj/house-room/copy/bm/rooms?houseAddrCode=` + houseAddrCode,
	})
}

/***批量配置银联账户(包括房租-电表-水表)*/
export const postBatchConfigMat = async (params: any) => {
	return await request.post({
		url: '/zwsj/house-room/batch/Mat',
		data: params,
	})
}
